<template>
  <div class="home-box">
    <!-- 顶部导航 -->
    <!-- fixed 固定导航位置 -->
    <!-- 固定 van-tab导航-->
    <van-nav-bar class="page-nav-bar" fixed>
      <van-button class="search-bth" slot="title" icon="search" type="primary"> </van-button>
    </van-nav-bar>
    <van-tabs class="changs-tags" v-model="active" animated swipeable>
      <van-tab v-for="item in list" :key="item.id" :title="item.name">
        <Artlist :channelId="item.id">

        </Artlist>
      </van-tab>

      <!-- 具名插槽 -->
      <div slot="nav-right" class="nav-right" @click="isshow=true">
        <i class=" toutiao toutiao-gengduo">
        </i>
      </div>
      <div slot="nav-right" class="placeholder">1</div>
    </van-tabs>
    <!-- 图标位置 -->
    <van-popup v-model="isshow" closeable close-icon-position="top-left" position="bottom" :style="{ height: '30%' }" />
  </div>
</template>

<script>
import { getUserChannles } from '@/app/user.js'
import Artlist from '@/views/home/artlist.vue'
export default {
  name: 'list',
  data () {
    return {
      isshow: false,
      active: '',
      list: []
    }
  },
  methods: {
    async loadUserChannles () {
      try {
        const res = await getUserChannles()
        console.log(res)
        this.list = res.data.data.channels
        console.log(this.list)
        // console.log(res)
      } catch (error) {
        this.$toast('获取频道列表错误')
      }
    }
  },
  computed: {},
  watch: {},
  filters: {},
  components: {
    Artlist
  },
  created () {
    this.loadUserChannles()
  },
  mounted () { }
}
</script>

<style scoped lang='less'>
.home-box {
  padding-top: 174px;
  padding-bottom: 100px;
  .search-bth {
    width: 555px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 32px;
    border: none;
  }
  /deep/ .van-icon-search {
    color: #fff;
  }
  /deep/ .van-nav-bar__title {
    max-width: unset;
  }
  /deep/ .changs-tags {
    .van-tabs__wrap {
      position: fixed;
      top: 92px;
      z-index: 2;
      width: 100%;
    }
    .van-tab {
      border-right: 1px solid #edeff3;
      min-width: 200px;
      height: 80px;
      .van-tab__text {
        font-size: 27px;
        color: #777777;
      }
    }
    .van-tab--active .van-tab__text {
      color: #333 !important;
    }
    .van-tabs__line {
      width: 31px !important;
      height: 6px;
      background: rgba(50, 150, 250, 1);
      border-radius: 3px;
      bottom: 8px;
    }
    .van-tabs__nav {
      padding: 0;
    }
    .nav-right {
      width: 66px;
      height: 82px;
      // 固定定位
      position: fixed;
      right: 0;
      background: rgba(255, 255, 255, 0.9);
      display: flex;
      justify-content: center;
      align-items: center;
      .toutiao {
        font-size: 33px;
      }
      &::before {
        content: '';
        width: 2px;
        height: 82px;
        background-image: url(~@/assets/gradient-gray-line.png);
        position: absolute;
        left: 0;
        background-size: 100% 100%;
      }
    }

    .placeholder {
      width: 66px;
      height: 82px;
      flex-shrink: 0;
    }
  }
}
</style>
